<template>
	<view class="content">
		<view class="status_bar"></view>
		<Head :webtext="webtext"></Head>
		<view class="body">
			<u-table class="table" bg-color="#151936" v-for="(item, index) in tableList" :key="item.id">
				<u-tr>
					<u-td width="40%" style="text-align:right;border-right:none;">钱包类型：</u-td>
					<u-td style="text-align:left">{{ item.bank_swift }}</u-td>
				</u-tr>
				<u-tr>
					<u-td width="40%" style="text-align:right;border-right:none;">账户信息：</u-td>
					<u-td style="text-align:left">{{ item.user_name }}</u-td>
				</u-tr>
				<u-tr>
					<u-td width="40%" style="text-align:right;border-right:none;">绑定时间：</u-td>
					<u-td style="text-align:left">{{ item.bank_address }}</u-td>
				</u-tr>
				<u-tr>
					<u-td width="40%" style="text-align:right;border-right:none;">操作：</u-td>
					<u-td style="text-align:left"><a  @click="wallet(1)">删除</a></u-td>
				</u-tr>
			</u-table>
			<view class="button"  @click="navto()">添加钱包</view>
			<!-- <view class="freePlay" @click="wallet(2)">锁定钱包</view> -->
		</view>
		<u-modal class="modal" v-model="show" :title="text+'钱包'" :show-cancel-button="true" @confirm="confirm">
			<p>请输入资金密码</p>
			<u-input
				style="padding: 0 20upx;"
				class="input"
				:password-icon="false"
				:clearable="false"
				v-model="password"
				placeholder=""
				type="password"
				placeholder-style="fontSize: 20upx;"
			/>
		</u-modal>
	</view>
</template>

<script>
import Head from '../../components/head.vue';
export default {
	components: {
		Head
	},
	data() {
		return {
			webtext: '钱包管理',
			list: [],
			tableList: [],
			show: false,
			password: '',
			text:''
		};
	},
	onShow() {
		this.getList()
	},
	methods:{
		getList(){
			this.$u.api.banklist().then(res => {
				this.tableList = res.data
			})
		},
		confirm(){
			this.$u.api.del_bank({
				password:this.password
			}).then(res => {
				uni.showToast({
					title: "删除成功",
					duration: 1000,
					icon: 'none'
				});
				this.getList()
			})
		},
		navto(url){
			uni.navigateTo({
				url:'/pages/mine/addWallet'
			})
		},
		wallet(type){
			this.show = true
			if(type===1){
				this.text='删除'
			}else{
				this.text='锁定'
			}
		}
	}
};
</script>

<style lang="scss" scoped>
.table {
	margin: 0 auto;
	margin-bottom: 40upx;
	font-size: 0.8em;
	width: calc(100% - 80upx);
	line-height: 42upx;
	color: #cbcbd6;
	a{
		color: #007aff;
	}
}
.button {
	width: calc(100% - 80upx);
	font-size: 34upx;
	margin: 30upx auto;
	height: 80upx;
	line-height: 80upx;
	color: #fff;
	background: #0da3ff;
	padding: 0 40upx;
	text-align: center;
	border-radius: 10upx;
}
.freePlay {
	width: calc(100% - 80upx);
	font-size: 34upx;
	height: 80upx;
	line-height: 80upx;
	text-align: center;
	border-radius: 8upx;
	margin: 0 auto;
	border: 2upx solid #d95235;
	color: #d95235;
	background-color: #fcf1e8;
	margin-top: 40upx;
}
.modal{
	font-size: 36upx;
	p{
		text-align: center;
		line-height: 80upx;
		font-size: 28upx;
	}
	.input{
		width: 90%;
		border:2upx solid #c0c0c0;
		padding: 0 10upx;
		    margin: 20upx auto;
	}
}
</style>
